Shaggy
|
Initiate
|
|
|
Reged: 04/03/03
|
Posts: 53
|
Loc: Nevada, USA
|
|
|
I'm making a script that will make a platform (it is an activator and model:in_t_platform_02.nif) that when you press a button that is on the wall on the first floor will go up to the second floor to a specific spot and stop . Then when you want back down you just press another button and the platform lowers. I have searched the forums and all i could seem to find on elevators was a script posted by Tommykhajiit Here .
I'm not very good with scripting so I used that with some of what i've learned from a scripting for dumbies thing by GhanBuriGhan and somewere in mutilating it i got these 2 scripts
Begin TOD_up
Short state
Float timer
If ( MenuMode == 1 )
Return
Endif
If ( onActivate == 1 )
Set state to 1
Endif
If ( state == 1 )
If ( TOD_elevator == 0 )
"TODelevator"->MoveWorld z 53
Set timer to ( timer + GetSecondsPassed )
Endif
If ( timer >= 7 )
Set timer to 0
Set state to 0
Set TOD_elevator to 1
Endif
Endif
End TOD_up
------------------------------------------------------------
Begin TOD_down
Short state
Float timer
If ( MenuMode == 1 )
Return
Endif
If ( onActivate == 1 )
Set state to 1
Endif
If ( state == 1 )
If ( TOD_elevator == 1 )
"TODelevator"->MoveWorld z -53
Set timer to ( timer + GetSecondsPassed )
Endif
If ( timer >= 7 )
Set timer to 0
Set state to 0
Set TOD_Elevator to 0
Endif
Endif
End TOD_down
-----------------------------------------
TOD_elevator is a Global i used to link the 2 scripts and TODelevator is the platform... the distance from were the platform starts to were i want it to stop is 524units (starts at 14284 and ends at 14808 and visa versa) somehow i got it to come very close at 371units...
The problem i keep getting is when i use the elevator (which is at the bottom of one of those telvanni flying holes) it will rise above the spot i wanted it to stop at. Slowly at first, then in around 3 or 4 ups and downs the platform will be too high to use and sometimes end up in or above the ceiling of the second floor on the up and in or above the ceiling (up the hole) of the first floor on the down. So can anyone tell me what is wrong with my script?
-------------------- Shaggy
I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly & forgivingly by the hand and lead him to a quiet place and kill him.
I don't give a damn for a man that can only spell a word one way.-Mark Twain
Azura's Castle
Edited by Shaggy (08/07/04 06:48 AM)
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1375
|
Loc: Gold Coast, Australia
|
|
|
First thing you need to do is change the font colour to something other than blue. That is extremely hard to read
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
|
|
Your scripts look fine to me, although I don't seem to understand why you let the elevator only travel for 371 units where you really want it to go 524 units. Anyway, a simple rule of thumb is not to let the elevator stop where it stops, but put it there where you want it to be. In other words, when the timer has reached its limit (I would suggest 9, or even 9,9) place the elevator using SetPos at the correct position. I've added two lines of code to your scripts, you could replace one of then by SetAtStart. Your scripts would look like this, hope thi helps.
Quote:
Begin TOD_up . Short state Float timer . If ( MenuMode == 1 ) Return Endif . If ( onActivate == 1 ) Set state to 1 Endif . If ( state == 1 ) If ( TOD_elevator == 0 ) "TODelevator"->MoveWorld z 53 Set timer to ( timer + GetSecondsPassed ) Endif If ( timer >= 7 ) Set timer to 0 Set state to 0 Set TOD_elevator to 1 "TODelevator"->SetPos Z, 14808 Endif Endif . End TOD_up . ------------------------------------------------------------ . Begin TOD_down . Short state Float timer . If ( MenuMode == 1 ) Return Endif . If ( onActivate == 1 ) Set state to 1 Endif . If ( state == 1 ) If ( TOD_elevator == 1 ) "TODelevator"->MoveWorld z -53 Set timer to ( timer + GetSecondsPassed ) Endif If ( timer >= 7 ) Set timer to 0 Set state to 0 Set TOD_Elevator to 0 "TODelevator"->SetPos Z, 14284 Endif Endif . End TOD_down . -----------------------------------------
-------------------- Tommy Khajiit's hidout
The Black Mill forums
Meet some nice people at The Hall of Torque
Post Extras:
|
Shaggy
|
Initiate
|
|
|
Reged: 04/03/03
|
Posts: 53
|
Loc: Nevada, USA
|
|
|
So that is how you set it to were you want After putting the setpos on and messing with the units, it worked well I guess i missed setpos when reading the dumbies manual... o well Thanx Tommy
-------------------- Shaggy
I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly & forgivingly by the hand and lead him to a quiet place and kill him.
I don't give a damn for a man that can only spell a word one way.-Mark Twain
Azura's Castle
Post Extras:
|
|
|
You're welcome.
-------------------- Tommy Khajiit's hidout
The Black Mill forums
Meet some nice people at The Hall of Torque
Post Extras:
|
DaiShan
|
Curate
|
|
|
Reged: 06/11/04
|
Posts: 441
|
Loc: Ne·vad·a (Neh'va'da) n. See: Hell
|
|
|
Ok, great, we (shaggy and I) got the script running well....we figured out that the timing problem had something to do with the fact that the script was written and added on shaggy's computer but the mod was made on mine (dont ask me why)...only, how do you put a sound on it? We have tried several different combinations using the command line
"TODelivator->PlaySoundLoop3DVP "Power lights 50" 1.0 1.0
What happens is that when the sound doesnt actually play, it only plays the first half second or so over and over in a loop, so it sounds like a CD skipping except faster. This normally wouldnt be too much of a problem, but its distorted. We can't get the sound to simply play (weve tried PlaySound rather than PlaySoundLoop too).
Oh, in case your confused, shaggy and i are brothers
-------------------- "The only sovereign you can allow to rule you is reason." - Wizard's Sixth Rule
People who claim to know everything annoy those of us that do.
Vote Your Sport!
Post Extras:
|
Shaggy
|
Initiate
|
|
|
Reged: 04/03/03
|
Posts: 53
|
Loc: Nevada, USA
|
|
|
Grrrr... all ya did was move the .esp back to ur comp and change the seconds to 10 and the speed to 52.4
Still wonderin how it works like it should on DaiShan's, but not on mine....
About the sound... we are trying to get the elevator to play the sound that the neon lights make until it stops. All sounds seem to not work right and make that constant sound that sounds like the first bit looping into a kind of buzz.
-------------------- Shaggy
I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly & forgivingly by the hand and lead him to a quiet place and kill him.
I don't give a damn for a man that can only spell a word one way.-Mark Twain
Azura's Castle
Post Extras:
|
|
|
This is a part of the script used in Tenience's Rare Items for the displaycases: Code:
if ( Timer < 3 ) PlaySound "Power light" MoveWorld Z, -30
It works fine for me, and I've never heard anyone complaining about the sound not plying right. Btw I have no idea why the plugin only works at DaiShan's rig.
Success!
-------------------- Tommy Khajiit's hidout
The Black Mill forums
Meet some nice people at The Hall of Torque
Post Extras:
|
DaiShan
|
Curate
|
|
|
Reged: 06/11/04
|
Posts: 441
|
Loc: Ne·vad·a (Neh'va'da) n. See: Hell
|
|
|
ok....you helped me figure out why the sound wasnt playing right...i had it tied to the timer, so every time the timer cycled, so did the sound...so every second the sound started over....
Now i am having a problem stopping the sound. This is my script so far:
Begin TOD_up
Short state Float timer
If ( MenuMode == 1 ) Return Endif
If ( onActivate == 1 ) Set state to 1 "TODelevator"->PlayLoopSound3DVP, "Power light" 1.0 1.0 Endif
If ( state == 1 ) If ( TOD_elevator == 0 ) "TODelevator"->MoveWorld z, 52.4 Set timer to ( timer + GetSecondsPassed ) Endif If ( timer >= 10 ) Set timer to 0 Set state to 0 Set TOD_Elevator to 1 "TODelevator"->SetPos z, 14808 Endif Endif
End TOD_up
Im using the PlaySoundLoop3DVP command too keep the sound playing for the full ten seconds (the entire time it takes the elevator to go from start to finish)...its only a 3 second long sound
Ive tried puting the StopSound, "PowerLights" Command in several places. including under the If( timer >=10 ) section, but i have had no success in stopping it. Any suggestions?
Thanks for all your help, btw.
-------------------- "The only sovereign you can allow to rule you is reason." - Wizard's Sixth Rule
People who claim to know everything annoy those of us that do.
Vote Your Sport!
Post Extras:
|
DaiShan
|
Curate
|
|
|
Reged: 06/11/04
|
Posts: 441
|
Loc: Ne·vad·a (Neh'va'da) n. See: Hell
|
|
|
bump
-------------------- "The only sovereign you can allow to rule you is reason." - Wizard's Sixth Rule
People who claim to know everything annoy those of us that do.
Vote Your Sport!
Post Extras:
|
Simpleton
|
Acolyte
|
|
|
Reged: 07/02/04
|
Posts: 138
|
Loc: Earlham College, Richmond, IN
|
|
|
you're right in using stopsound. It is the command to stop looping sound. It might be a glitch with PlayLoopSound3dVP, but I've only used the non VP functions so I wouldn't know. My advice would be to test out the functions using a very simply script, and then slowly add features till it stops working (If it ever does). It really is the only sure fire way to get to the root of the problem.
-------------------- Do you have a burning desire to give me money?
Click Here to Donate
Post Extras:
|
|
|
Simpleton is correct.
But to rule out the obvious, you use: "TODelevator"->PlayLoopSound3DVP, "Power light" 1.0 1.0 and later you try: StopSound, "PowerLights"
I do hope you ment StopSound, "Power light"
Anyway my best bet would be:
If ( timer >= 10 ) Set timer to 0 Set state to 0 Set TOD_Elevator to 1 "TODelevator"->SetPos z, 14808 StopSound, "Power light" Endif Endif
-------------------- Tommy Khajiit's hidout
The Black Mill forums
Meet some nice people at The Hall of Torque
Post Extras:
|
DaiShan
|
Curate
|
|
|
Reged: 06/11/04
|
Posts: 441
|
Loc: Ne·vad·a (Neh'va'da) n. See: Hell
|
|
|
yeah, that would be the obvious solution...unfortunately, the obvious solution doesnt work...guess ill have to keep trying...thanks anyway
-------------------- "The only sovereign you can allow to rule you is reason." - Wizard's Sixth Rule
People who claim to know everything annoy those of us that do.
Vote Your Sport!
Post Extras:
|
DaiShan
|
Curate
|
|
|
Reged: 06/11/04
|
Posts: 441
|
Loc: Ne·vad·a (Neh'va'da) n. See: Hell
|
|
|
Success!!
I figured out the problem....and now i feel stupid for not seeing it before...
You had the positioning of the stopsound command right, tommy, but i had forgotten about something.....i had attached the sound to the elevator using the command "TODelevator"->PlaySoundLoop "Power light" 1.0 1.0. Because of this, i couldnt simply put stopsound "power light" in the script...i also had to attach it to the elevator using the command "TODelevator"->StopSound "Power light". I tried it out this morning and it worked perfectly.
Thanks for all your help
-------------------- "The only sovereign you can allow to rule you is reason." - Wizard's Sixth Rule
People who claim to know everything annoy those of us that do.
Vote Your Sport!
Post Extras:
|
|
|
Well, I didn't notice it
Concratz!
-------------------- Tommy Khajiit's hidout
The Black Mill forums
Meet some nice people at The Hall of Torque
Post Extras:
|